package com.hnkywl.sts.service.sfgl;

import com.hnkywl.sts.dao.organ.EjzhDao;
import com.hnkywl.sts.dao.organ.GsjgDao;
import com.hnkywl.sts.dao.sfgl.KhskdDao;
import com.hnkywl.sts.dao.sfgl.SkshDao;
import com.hnkywl.sts.dao.zjfp.KyzjDao;
import com.hnkywl.sts.dao.zjfp.KyzjzsDao;
import com.hnkywl.sts.dao.zjgl.PjglDao;
import com.hnkywl.sts.dao.zjgl.XyzDao;
import com.hnkywl.sts.entity.organ.Ejzh;
import com.hnkywl.sts.entity.organ.Nbgs;
import com.hnkywl.sts.entity.sfgl.Sfk;
import com.hnkywl.sts.entity.sys.Yg;
import com.hnkywl.sts.entity.zjfb.Kyzj;
import com.hnkywl.sts.entity.zjfb.Kyzjzs;
import com.hnkywl.sts.entity.zjgl.Pj;
import com.hnkywl.sts.entity.zjgl.Xyz;
import com.hnkywl.sts.service.base.BmService;
import com.hnkywl.sts.service.organ.KhhService;
import com.hnkywl.sts.service.sys.YgService;
import com.hnkywl.sts.service.zjgl.PjglService;
import com.hnkywl.sts.service.zjgl.XyzService;
import com.hnkywl.sts.util.BaseUtils;
import com.hnkywl.sts.util.ReflectionUtils;
import net.ruixin.orm.hibernate.Page;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Actions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created with IntelliJ IDEA.
 * User: cyh
 * Date: 13-4-19
 * Time: 上午10:41
 * To change this template use File | Settings | File Templates.
 */
@Service
public class KhskdService {
   private KhskdDao khskdDao;
    private GsjgDao gsjgDao;


    /**
     * 查询付款审核列表
     *
     * @param
     * @param pageNo
     * @param pageSize
     * @return
     */
    @Transactional
    public String findAllKhskd(Date skshStart, Date skshEnd, String bm, String sbgsMc,  String gldwMc, String zt,String skr, int pageNo, int pageSize) {
        Page<Sfk> sfkPage = this.khskdDao.findSklxList(skshStart, skshEnd, bm, sbgsMc,  gldwMc, zt, skr,pageNo, pageSize);
        List<Sfk> ygList = sfkPage.getResult() == null ? new ArrayList<Sfk>() : sfkPage.getResult();
        String ygJson = BaseUtils.fetchCollectionToJson(ygList, "id", "bm", "sfkrq", "sfklx", "gldw.qc", "kxyt.z","sfje", "pjlx.z", "kxlx", "sbgs.jc", "sbr.xm", "bz", "zt", "shrq");
        return "{\"total\":" + sfkPage.getTotalCount() + ",\"rows\":[" + ygJson + "]}";
    }

    @Transactional
    public Sfk findKhskdDetail(Long id) {
        return this.khskdDao.get(id);
    }

    @Autowired
    public void setKhskdDao(KhskdDao khskdDao) {
        this.khskdDao = khskdDao;
    }

    @Autowired
    public void setGsjgDao(GsjgDao gsjgDao) {
        this.gsjgDao = gsjgDao;
    }
}